using System;

namespace LoRel {
    
    public class TableRow {
        public readonly Key Key;
        public readonly Object ExternalData;

        public TableRow( Key key, object external_data ) {
            Key = key;
            ExternalData = external_data;
        }
        
        #region Equality operators

        public bool Equals( TableRow other ) {
            if( ReferenceEquals( null, other ) ) return false;
            if( ReferenceEquals( this, other ) ) return true;
            return Key.Equals( other.Key );
        }

        public override bool Equals( object obj ) {
            if( ReferenceEquals( null, obj ) ) return false;
            if( ReferenceEquals( this, obj ) ) return true;
            if( obj.GetType() != typeof( TableRow ) ) return false;
            return Equals( ( TableRow ) obj );
        }

        public override int GetHashCode() {
            return ( Key != null ? Key.GetHashCode() : 0 );
        }

        #endregion
    }
}